<?php  //functions.php



function make_safe($variable) {

   $variable = addslashes(trim($variable));

   return $variable;

}

function check_user(){
	session_start();
        if (isset($_SESSION['usuario'])) {
        		return true;
        } 
	return false;
}

function check_admin(){
	session_start();
        if ($_SESSION['usuario']=='admin') {
        		return true;
        } 
	return false;
}

//
// Leer y Guardar archivos
//

function ReadFromFile($filename){

	$f = fopen($filename,"r");
	$content = fread($f,filesize($filename));
	fclose($f);
	return $content;

}

function SaveToFile($filename,$content){

	$f = fopen($filename,"w");
	fputs($f,"$content");
	fclose($f);

}
?>
